package day0114;

import java.util.Arrays;

public class Test7 {
    public static void main(String[] args) {
        //int[]  a={8,6,4,3,9,0,7};
        int[]   arr1 ={4,3,9,0};
        sort(arr1);
    }

    private static void sort(int[] a) {
        //第一轮
        //                a.length-1
        for (int i = 0; i < a.length-1-0; i++) {
            if(a[i]>a[i+1]){
                int t=a[i];
                a[i]=a[i+1];
                a[i+1]=t;
            }
        }//将9放到最后


        //第一轮
        //                a.length-1-1
        for (int i = 0; i < a.length-1-1; i++) {
            if(a[i]>a[i+1]){
                int t=a[i];
                a[i]=a[i+1];
                a[i+1]=t;
            }
        }//将4放到倒数第二位             将9放到最后


        //第一轮
        //                a.length-1-2
        for (int i = 0; i < a.length-1-2; i++) {
            if(a[i]>a[i+1]){
                int t=a[i];
                a[i]=a[i+1];
                a[i+1]=t;
            }
        }//将3放到倒数第三位,  将4放到倒数第二位             将9放到最后


        System.out.println(Arrays.toString(a));
    }
}
